-
-
Notifications
You must be signed in to change notification settings - Fork 165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: improve mfa.enroll
return types
#956
fix: improve mfa.enroll
return types
#956
Conversation
Use TypeScript's operator overloading to return - TOTP data when `mfa.enroll` was passed `factorType: 'totp'`, - phone data when `mfa.enroll` was passed `factorType: 'phone'`. This fixes a breaking change in the types in b957c30.
Would agree with this Thanks for the PR! Looks great so far |
Will follow up with the corresponding PR for Upd: shouldn't be needed, except in relation to MFA (WebAuthn). |
If you are still interested in this, I think the easiest way to do this would be to make a new file called something like Then, (the hardest thing would be picking the right conventional commit prefix 😆, since this PR has already been merged, but not released, so it's not yet a breaking change)
Yep, we use both And I'm excited to see WebAuthn support! |
@aloisklink, thanks for the update. I think an internal-types file would work. Let me do that shortly. Thanks! |
## What kind of change does this PR introduce? Follow up to #956, hides the MFA sub-types (e.g. MFA Phone, MFA TOTP) needed to fix type errors before we release to public so that we can remove them as and when we like. The sub-types are now stored in an `internal-types` file which, unlike the `types` file is not exposed to public. The types mentioned here have not been released yet so fine to hide them
🤖 I have created a release *beep* *boop* --- ## [2.65.1](v2.65.0...v2.65.1) (2024-10-14) ### Bug Fixes * Call `SIGNED_OUT` event where session is removed ([#854](#854)) ([436fd9f](436fd9f)) * improve `mfa.enroll` return types ([#956](#956)) ([8a1ec06](8a1ec06)) * move MFA sub types to internal file ([#964](#964)) ([4b7455c](4b7455c)) * remove phone mfa deletion, match on error codes ([#963](#963)) ([ef3911c](ef3911c)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
What kind of change does this PR introduce?
Bug fix for the TypeScript types.
What is the current behavior?
mfa.enroll
's return type has a TypeScript breaking change in v2.65.0 #955What is the new behavior?
Use TypeScript's function overloading to return
mfa.enroll
was passedfactorType: 'totp'
,mfa.enroll
was passedfactorType: 'phone'
.This fixes a breaking change in the types in b957c30.
Additional context
This PR would also expose the new following types:
MFAEnrollTOTPParams
MFAEnrollPhoneParams
AuthMFAEnrollTOTPResponse
AuthMFAEnrollPhoneResponse
AuthMFAEnrollErrorResponse
(it might be better to roll this type in with the other two).It might be better to keep these types private, since once they're exposed, you can't easily remove them again without creating a breaking change.